home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / TextEdit / TextEditClipboard.cp next >
Text File  |  2000-06-23  |  740b  |  51 lines

  1. // TextEditClipboard.cp
  2.  
  3. #ifndef TextEditClipboard_h
  4. #include "TextEditClipboard.h"
  5. #endif
  6. #ifndef OSError_h
  7. #include "OSError.h"
  8. #endif
  9.  
  10. #include <TextEdit.h>
  11. #include <Errors.h>
  12.  
  13. TextEditClipboard::~TextEditClipboard()
  14.   {
  15.     try
  16.       {
  17.         Flush();
  18.       }
  19.      catch ( ... )
  20.       {
  21.       }
  22.   }
  23.  
  24. void TextEditClipboard::Import( const ScrapReader& )
  25.   {
  26.     OSErr error = TEFromScrap();
  27.     if ( error != noTypeErr )
  28.         ThrowOSError( error );
  29.   }
  30.  
  31. void TextEditClipboard::Export( ScrapWriter& ) const
  32.   {
  33.     ThrowOSError( TEToScrap() );
  34.   }
  35.  
  36. void TextEditClipboard::Clear()
  37.   {
  38.   }
  39.  
  40. TextEditClipboard& TextEditClipboard::The()
  41.   {
  42.     static TextEditClipboard the;
  43.     return the;
  44.   }
  45.  
  46. uint32 TextEditClipboard::Length()
  47.   {
  48.     Validate();
  49.     return TEGetScrapLength();
  50.   }
  51.